﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ZQNB.BaseLib.Core.Models;

namespace ZQNB.BaseLib.Core.Services
{
    public class AceSettingService : IAceSettingService
    {
        private readonly CoreDataHelper _fileDbHelper;

        public AceSettingService(CoreDataHelper fileDbHelper)
        {
            _fileDbHelper = fileDbHelper;
        }
        
        public AceSetting GetAceSetting()
        {
            var setting = _fileDbHelper.Read<AceSetting>().SingleOrDefault();
            return setting;
        }

        public void SaveAceSetting(AceSetting model)
        {
            var settings = new List<AceSetting> {model};
            _fileDbHelper.Save(settings);
        }
    }
}